grammar daas_where;

options {
  output=AST;
}

@header {
package com.deepclassifieds.daas.ql.where;
}

start_rule
	:	condition_expr
        ;
         
condition_expr
	:	condition_eq
	|	condition_and
	|	condition_or
	;

condition_eq
	:	EQ LPAREN NAME COMMA VALUE RPAREN
	;

condition_and
	:	AND LPAREN condition_expr COMMA condition_expr RPAREN
	;

condition_or
	:	OR LPAREN condition_expr COMMA condition_expr RPAREN
	;

NAME
	:	('a'..'z'|'A'..'Z'|'_') ('a'..'z'|'A'..'Z'|'0'..'9'|'_')* ;
	;
VALUE
	:	'A' .. 'Z' ( 'A' .. 'Z' | '0' .. '9' | '_' | '$' | '#' )*
	;
COMMA 
	:	','
	;
LPAREN
	:	'('
	;		
RPAREN
	:	')'
	;
EQ
	:	'EQ'
	;
AND
	:	'AND'
	;
OR
	:	'OR'
	;
